from django.db import models
from user.models import UserProfile
from video.models import Videos
from comment.models import Comment, Comment_Comment


# Create your models here.

class Like(models.Model):
    lid = models.AutoField(primary_key=True)
    user_id = models.ForeignKey(UserProfile, on_delete=models.CASCADE, related_name='user_id')
    video_id = models.ForeignKey(Videos, on_delete=models.CASCADE, related_name='video_id')
    is_active = models.BooleanField(default=True)
    is_rendered = models.BooleanField(default=False)
    time = models.DateTimeField(auto_now=True)


class Like_Comment(models.Model):
    lcid = models.BigAutoField(primary_key=True)
    user = models.ForeignKey(UserProfile, on_delete=models.CASCADE, related_name='like_comment_user')
    comment = models.ForeignKey(Comment, on_delete=models.CASCADE, related_name='like_comment_comment')
    type = models.BooleanField()  # 表示是赞还是踩
    is_active = models.BooleanField(default=True)
    is_rendered = models.BooleanField(default=False)
    time = models.DateTimeField(auto_now=True)


class Like_Comment_Comment(models.Model):
    lccid = models.BigAutoField(primary_key=True)
    user = models.ForeignKey(UserProfile, on_delete=models.CASCADE, related_name='like_comment_comment_user')
    comment_comment = models.ForeignKey(Comment_Comment, on_delete=models.CASCADE,
                                        related_name='like_comment_comment_comment')
    type = models.BooleanField()  # 表示是赞还是踩
    is_active = models.BooleanField(default=True)
    is_rendered = models.BooleanField(default=False)
    time = models.DateTimeField(auto_now=True)
